home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 07 - 1991 / 07.08 Aug 91 / Browser sources / CBrowserApp.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-01-19  |  1.5 KB  |  65 lines  |  [TEXT/KAHL]

  1. /******************************************************/
  2. /*                                                                                                      */
  3. /*    CBrowserApp.c                                                                          */
  4. /*                                                                                                      */
  5. /*    Written in Think C version 4.0.2                                  */
  6. /*    Based on CStarterApp.c                                                        */
  7. /*                                                                                                      */
  8. /*    Allen Stenger    January 1991                                              */
  9. /*                                                                                                      */
  10. /******************************************************/
  11.  
  12. #include "CBartender.h"
  13. #include "CBrowserApp.h"
  14. #include "CBrowserDoc.h"
  15. #include "Commands.h"
  16. #include "Browser.h"
  17.  
  18. extern    OSType    gSignature;
  19. extern    CBartender    *gBartender;
  20.  
  21. void CBrowserApp::IBrowserApp(void)
  22. {
  23.     CApplication::IApplication(4, 20480L, 2048L);
  24. }
  25.  
  26. void CBrowserApp::SetUpFileParameters(void)
  27. {
  28.     inherited::SetUpFileParameters();
  29.     sfNumTypes = 1;
  30.     sfFileTypes[0] = 'TEXT';
  31.     gSignature = '????';
  32. }
  33.  
  34. void CBrowserApp::DoCommand(long theCommand)
  35. {
  36.     short            itemHit; /* which item in dialog selected */
  37.     DialogPtr    theDialogP;    /* pointer to About dialog         */
  38.     
  39.     switch (theCommand) {
  40.         case cmdAbout:        
  41.                     theDialogP = GetNewDialog(dlogAbout, 
  42.                                                                             NULL, -1L);
  43.                     ModalDialog(NULL, &itemHit);
  44.                     DisposDialog(theDialogP);
  45.                     break;
  46.         default:    inherited::DoCommand(theCommand);
  47.                     break;
  48.     }
  49. }
  50.  
  51. void CBrowserApp::OpenDocument(SFReply *macSFReply)
  52. {
  53.     CBrowserDoc    *theDocument;
  54.     
  55.     theDocument = new(CBrowserDoc);
  56.     theDocument->IBrowserDoc(this, FALSE);
  57.          /* we never print */
  58.     theDocument->OpenFile(macSFReply);
  59. }
  60.  
  61. void    CBrowserApp::StartUpAction(short    numPreloads)
  62. {
  63.     FlushEvents(everyEvent, 0);
  64.     DoCommand(cmdOpen);
  65. }